﻿using System;
using MemoryPack;

namespace SerializeDemo;

[MemoryPackable]
[ProtoBuf.ProtoContract]
public partial class BasePacket
{
    public byte Key { get; set; }

    public byte[] Body { get; set; } = default!;

    public int ErrorCode { get; set; }

    public string? ErrorMessage { get; set; }
}

[MemoryPackable]
[ProtoBuf.ProtoContract]
public partial class BasePacket<TBody> where TBody : class
{
    public byte Key { get; set; }

    public TBody Body { get; set; } = default!;

    public int ErrorCode { get; set; }

    public string? ErrorMessage { get; set; }
}


